package top.chukongxiang.monitorservice.config;

import top.chukongxiang.monitorservice.components.SockjsPrincipal;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author 楚孔响
 * @version 1.0
 * @date 2023/8/28 11:19
 */
public class SockJsContextHolder {

    private static final Map<String, SockjsPrincipal> SESSIONID_CLIENT_ID = new ConcurrentHashMap<>();

    public static void addClient(String sessionId, SockjsPrincipal principal) {
        SESSIONID_CLIENT_ID.put(sessionId, principal);
    }

    public static void remove(String sessionId) {
        SESSIONID_CLIENT_ID.remove(sessionId);
    }

    public static SockjsPrincipal getClientId(String sessionId) {
        return SESSIONID_CLIENT_ID.get(sessionId);
    }

}
